Configuring MATLAB

The steps below are recommendations for configuring your version of MATLAB for use in CS211.  You may decide to configure your system differently once you become more familiar with MATLAB.

I. Setting the MATLAB Search Path

If you have not already created a folder for this course, create a folder named CS211 in your My Documents folder.  (You can do this with File --> New --> Folder in Windows Explorer.)  You should put all of your CS211 files for this course in this folder (or subfolders of this folder).

Once you have created a CS211 folder, start MATLAB.  After MATLAB has started, select File --> Set Path... and then click on  Add Folder.  Then browse to your CS211 folder. Next press the Make New Folder button and type in MATLAB Programs for your new folder name (this will be a folder under your CS211 folder).  Then click on OK, then Save, then Close.  Now when you attempt to run one of your programs, MATLAB will look for the program in your MATLAB Programs folder in your CS211 folder (instead of the default work folder).

 

II. Setting Your MATLAB Startup Folder

Setting your MATLAB start up folder to your CS211\MATLAB Programs folder will save you time in finding your CS211 programs.  By default, your startup folder probably is "C:\Program Files\MATLAB\R2007a\work".  Whenever you browse in the MATLAB editor, you will start in your startup folder.  You want to change the default startup folder to the folder where you will save your CS211 MATLAB programs.  If you followed the instructions above, your programs folder should be named something like

    C:\Documents and Settings\first.last.USAFA\My Documents\CS211\MATLAB Programs.

Do the following to change your MATLAB startup folder to your ...\CS211\MATLAB Programs folder.

1.  Copy the full name of your CS211 MATLAB programs folder.  One way to do this is to browse to that folder in Windows Explorer (My Documents --> CS211 --> MATLAB Programs) and then copy the full folder name from the Address box at the top of Windows Explorer.  The full file name should be similar to the long folder name listed above.

2.  Right click on the icon you use to start up MATLAB (this may be an icon on your desktop, an icon in your programs menu, or both) and select Properties.  Select the Shortcut tab.  Then paste the full folder name you just copied into the Start in box.  Once you have done this, you should see a screen similar to the one below.  Note that you cannot see the full folder name in the Start in box and that double quotes should get added automatically after you press OK.   Also, delete "-sd" from the Target box so that the Target box reads something similar to "C:\Program Files\MATLAB\R2007a\bin\matlab.bat" $documents\MATLAB. Press OK to finish.

3.  Test your startup file folder by exiting and restarting MATLAB.  You should now see you ...\CS211\MATLAB Programs folder listed in the Current Directory window, as shown below.

 

III. Setting the MATLAB Desktop Layout

By default, the MATLAB environment displays 3 frames.  The Current Directory frame is in the upper left, the Command History frame is in the lower left, and the Command Window is on the right side of the screen.  While the Current Directory and Command History frames are useful, you will not use them nearly as much as the Command Window and the Editor Window

To simplify the appearance of the MATLAB environment, allow the Command Window to use the full MATLAB window.  To do this, select Desktop --> Desktop Layout --> Command Window Only.  If you wish to see any hidden windows at a later time, just select the windows you want to see using the Desktop menu.  Once you have completed this, your MATLAB window should appear similar to the image below.   

 

IV. Setting Text Wraparound In the Command Line Window

By default, text displayed in the command line window does not wrap around to the next line.  Thus, for very long lines of text (which are common for error messages), you may need to scroll the command window to the right to see all of the text.  Usually, it is convenient to have long text lines wrap around to multiple lines so you do not have to scroll horizontally.  To turn on the text wrap feature, bring up the Preferences dialog box (File --> Preferences...). Then, in the left-hand column of choices, select Command Window. Now check the Wrap Lines check box.  Press the Ok button when you are done. 

 

V. Other Customizations

There are many other ways to customize your MATLAB desktop such as changing the text font.  To see options for customization select Preferences… under MATLAB's File menu.